package me.zk.practice1.hw;

import java.lang.reflect.Array;
import java.util.*;

public class HWBJ62 {
    //5
    //1 0 0 2 2
    //2 6 1 8 3
    //3 3 2 5 4
    //5 5 4 7 6
    //4 0 4 2 6
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        List<Panel> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int[] nums = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            Panel panel = new Panel(nums[0],nums[1],nums[2],nums[3],nums[4]);
            list.add(panel);

        }
        //找基准灯
        Collections.sort(list);

        Panel p = list.get(0);

        int h = p.y2 - p.y1;
        int index = 1;
        while (index < list.size()) {

            Panel temp = list.get(index);
            if (temp.y1 - p.y1 <= h/2) {
                temp.y1 = p.y1;
                temp.y2 = p.y2;
            } else {
                p = temp;
            }
            index++;

        }
        Collections.sort(list);
        StringBuilder res = new StringBuilder();
        for (Panel panel : list) {
            res.append(panel.id).append(" ");
        }
        System.out.println(res.substring(0,res.length()-1));

    }

    static class Panel implements Comparable<Panel>{
        int id;
        int x1;
        int y1;
        int x2;
        int y2;

        public Panel(int id, int x1, int y1, int x2, int y2) {
            this.id = id;
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x2;
            this.y2 = y2;
        }

        @Override
        public int compareTo(Panel p) {
            if (p.y1 == this.y1) {
                return this.x1-p.x1;
            }
            return this.y1-p.y1;
        }
    }
}
